package org.wendu.wdoa.common;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;


public class CurrentUser implements UserDetails {

    private String userId;//账号
    private String userName;//姓名
    private String userPwd;//密码

    public CurrentUser(String userId,String userName,String userPwd){
        this.userId = userId;
        this.userName = userName;
        this.userPwd = userPwd;
    }
    public CurrentUser(String userId,String userName){
        this.userId = userId;
        this.userName = userName;
    }

    public String getUserId(){
        return userId;
    }
    public String getUserName(){
        return userName;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return userPwd;
    }

    @Override
    public String getUsername() {
        return userId;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public void setPassword(String password) {
        this.userPwd = password;
    }
}
